import 'package:boss/models/takeout_order_list_data.dart';
import 'package:boss/textStyle/text_style.dart';
import 'package:boss/ui/page/takeoutManagement/constant/takeout_status.dart';
import 'package:hi_common/hi_common.dart';
import 'package:flutter/material.dart';
import 'package:flustars/flustars.dart' as flustars;

class EstimatedDeliveryedTime extends StatelessWidget {
  final TakeoutOrderItem data;

  const EstimatedDeliveryedTime({Key key, this.data}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    if ([TakeoutStatus.NEW_ORDER, TakeoutStatus.TAKE_PICKUP, TakeoutStatus.IN_DELIVERY].contains(data.type) &&
        data.type == TakeoutStatus.TAKEOUT &&
        data.systemOrderStatus != TakeoutStatus.ABNORMA_ORDER) {
      var ctime = DateTime.parse(data.ctime);
      var deliveryedTime = ctime.add(Duration(minutes: 50));
      var deliveryedTimeText = flustars.DateUtil.formatDate(deliveryedTime, format: flustars.DateFormats.h_m);

      return Container(
        margin: EdgeInsets.only(
          left: 15.w,
        ),
        child: Text(
          '预计$deliveryedTimeText送达',
          style: TextStyleConstant().normal_1_28,
        ),
      );
    }
    return SizedBox();
  }
}
